package org.jgs1904.tieba.service.impl;

import org.jgs1904.tieba.entity.User;
import org.jgs1904.tieba.repository.UserRepository;
import org.jgs1904.tieba.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

/**
 * @author junki
 * @date 2020/5/12 14:40
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    @Override
    public User save(User user) {
        return userRepository.save(user);
    }

    @Override
    public User getOne(User user) {
        return userRepository.findOne(Example.of(user)).orElse(null);
    }

}
